<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>对象的扩展</title>
  </head>
  <body>
    <script>
      const school = {
        name: "书中",
        age: 28,
        sex: "男",
        cities: ["北京", "上海", "深圳"]
      };
      // 获取对象所有的key
      console.log(Object.keys(school));
      // 获取对象的所有的值
      console.log(Object.values(school));
      // entries
      console.log(Object.entries(school));
      // 利用entries创建map对象
      const m = new Map(Object.entries(school));
      console.log(m);

      // 获取属性的描述符
      console.log(Object.getOwnPropertyDescriptors(school));

      const obj = Object.create(null, {
        name: {
          value: "阙芳芳",
          writable: true,
          configurable: true,
          enumerable: true
        }
      });

      console.log(Object.getPrototypeOf(obj));
      console.log(Object.getOwnPropertyDescriptors(obj));
    </script>
  </body>
</html>
